473,464 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Add a .js file to an aspx using inheritance

Hi everyone,

I have several aspx files which inherit from a common file called
Menu.

In this file, I overwrite the Page_Load method and I put inside it the
LoadControl method to load an user control to the daughters without
having these any code line referred to that control (@Register
control, ...).

Now, I would like to do the same for the js files and the css files. I
would like to add them just by inheritance and not by code or by
using "id" or "runat='server'" inside the webforms.

Is there any solution apart from parsing the HTML, looking for the
"head" tag, adding the code and substituting the control?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 15 '05 #1
2 4258
elbomberotorero,

Yes, you can do this. In your control, at some point, you have to make
a call to the RegisterStartupScript method on the Page class (which you can
get through the control), passing in the javascript (or reference) which you
will need.

As for CSS files, I am not sure if you can do that, but you might have
to inject that directly into the stream.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"elbomberotorero" <el*************@hotmail-dot-com.no-spam.invalid> wrote in
message news:40********@127.0.0.1...
Hi everyone,

I have several aspx files which inherit from a common file called
Menu.

In this file, I overwrite the Page_Load method and I put inside it the
LoadControl method to load an user control to the daughters without
having these any code line referred to that control (@Register
control, ...).

Now, I would like to do the same for the js files and the css files. I
would like to add them just by inheritance and not by code or by
using "id" or "runat='server'" inside the webforms.

Is there any solution apart from parsing the HTML, looking for the
"head" tag, adding the code and substituting the control?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---
Nov 15 '05 #2
Thanx,

I've achieved to inherit the js file using RegisterClientScriptBlock
and it works!!!!!!!!
I dont understand what you mean about inject it into the stream. Any
example?

----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David | last post by:
I have two classes and a web page: test1.cs, test2.cs, and test.aspx. I know how to add a reference to test1.cs from test.aspx using the assembly directive (<%@ Assembly Src="test1.cs" %>). This...
5
by: Guoqi Zheng | last post by:
Dear sir, If I need to use a function on xxx.aspx page, e.g. on a repeater control, I have to define this function inside xxx.aspx.vb file, if I put it in the module class, it will not work so I...
9
by: Ryan Ternier | last post by:
I just got moved to a project that has an inheritance structure sort of like this: MyWebPage.aspx inherits ---> MyWebPage.ASPX.VB inherits ----> Utility.VB inherits -----> DHTMLMenu.vb...
6
by: mister.mwa | last post by:
Hello, I have the following problem: I have a class Foo, and a class Bar. I want Foo to inherit from Bar, but i want to put them in separate files Foo.vb and Bar.vb. Then i will use the Foo...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
9
by: Alan Silver | last post by:
Hello, I have a user control which I am trying to load dynamically, but am running into problems. I think the problem is because I have two .ascx files that refer to the same .ascx.cs file. A...
3
by: savvy | last post by:
I'm using "Visual Studio 2005 Professional". I'm half way through in my project development. I've created a New Website in the Visual Studio 2005 and developing my project over there. When i wanted...
2
by: Hiten | last post by:
Is it possible to have more code behind file but that file will have same class in way of partial class, Default Structure I -------------- Homepage.aspx + Homepage.aspx.cs (this .cs file...
7
by: iguana84 | last post by:
Hi, I have a newbie question for (ASP.Net 2.0 framework) which is based on Design Pattern / Coding Trick --> I need to :- - Inherit one aspx page and its code (super abstract class)...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.